@extends('app')

@section('content')
<ul class="nav nav-tabs">
    <li class="active"><a href="{{ url('/admin/enterprise/jobs/index')}}">信息列表</a></li>
    <li><a href="{{ url('/admin/enterprise/jobs/index/create') }}">信息添加</a></li>
</ul>
<div class="panel panel-info mt20">
    <div class="panel-heading">筛选</div>
    <div class="panel-body">
        <form action="" method="get" class="form-horizontal" role="form" id="form1">
            <div class="input-group">
                <div class="input-group-addon">职位名称</div>
                <input class="form-control" name="title" type="text" value="{{$title}}" placeholder="职位名称">
                <div class="input-group-addon">企业名称</div>
                <input class="form-control" name="username" type="text" value="{{$username}}" placeholder="企业名称">
            </div>
            <div class="form-group mt10">
                <div class="col-md-1 col-xs-12">
                    <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                   
                </div>
            </div>
        </form>
    </div>
</div>
<div class="panel panel-default mt20">
    <div class="table-responsive panel-body">
        <table class="table table-hover">
          <thead>
            <tr>
              <th><input id="checkAll" type="checkbox" value=""></th>
              <th>职位名称</th>
              <th>企业名称</th>
              <th>发布用户</th>
              <th>地区</th>
              <th>分类</th>
              <th>职位状态</th>
              <th>发布时间</th>
              <th>操作</th>
            </tr>
          </thead>
          <tbody>
          @foreach($jobs as $res)
            <tr id="news_{{ $res->jobs_id }}">
              <td><input type="checkbox" name="comments" value="{{ $res->jobs_id }}"></td>
              <td><a href="{{ url('/admin/enterprise/jobs/index/'.$res->jobs_id.'/edit') }}" >{{ str_limit($res->title,20) }}</a></td>
              <td>{{ count($res->company)?str_limit($res->company->name,20):'企业已被删除' }}</td>
              <td>{{ $res->userinfo->name }}</td>
              <td>{{ count($res->areas)>0?$res->areas->title:'北京市' }}</td>
              <td>
              @if(count($res->category)>0)
                @if(count($res->category->parentCate)> 0 ) 
                    {{$res->category->parentCate->name}} > {{ $res->category->name }} 
                @else 
                    {{ count($res->category)>0 ? $res->category->name : '无' }} 
                @endif 
              @else
                无
              @endif
              
              </td>
              <td>
                @if($res->status == 0)
                <span class="glyphicon glyphicon-eye-open" onclick="companyJobModel('admin/enterprise/jobs/index',{{ $res->jobs_id }})" style="color: #2ECC71;cursor: pointer;">
                        未审核
                </span>
                @elseif($res->status == 1) 
                <font color="#00CC99">审核通过</font> 
                @elseif($res->status ==2) 
                <font color="#990066">审核不通过</font> 
                @else 关闭 @endif
              </td>
              <td>{{ $res->created_at}}</td>
              <td>
                <a href="{{ url('/admin/enterprise/jobs/index/'.$res->jobs_id.'/edit') }}"><i class="glyphicon glyphicon-edit"></i></a>&nbsp;&nbsp;&nbsp;&nbsp;
                <a href="javascript:void(0);" onclick="delete_one('/admin/enterprise/jobs/index/{{$res->jobs_id}}','{{$res->jobs_id}}','{{ csrf_token() }}')"><i class="glyphicon glyphicon-remove-sign"></i></a>
              </td>
            </tr>
          @endforeach
          </tbody>
        </table>
    </div>
</div>
<div>
    <a class="btn btn-danger" onclick="batch_del('/admin/enterprise/jobs/index','{{ csrf_token() }}', 'id', 'comments'); ">
        <i class="icon-trash icon-large"></i>
            删除
    </a>
</div>
<div>{!! $jobs->render() !!} </div>
<div class="modal fade bs-example-modal-lg" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">职位审核</h4>
            </div>
            <div class="modal-body">
                <form id='validated'>
                    <table class="table table-striped" id="showinfos">
                    </table>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-info" id="submittags" data-dismiss="modal" onclick="to_validate('/admin/enterprise/jobs/validated','{{ csrf_token() }}')">确定</button>
                <button type="button" class="btn" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
<!--
$(document).ready(function(){
    /*复选框样式*/
    $('input').iCheck({
        checkboxClass: 'icheckbox_flat-blue',
        radioClass: 'iradio_flat-blue',
        increaseArea: '-10' // optional
    });

    /*全选*/
    $('#checkAll').on('ifClicked', function(event){
        $('input[name="comments"]').iCheck('check');
    });
});
//-->
</script>
@endsection
